import type { FC } from 'react'
import { useState } from 'react'
import { Routes, Route, HashRouter, Navigate } from 'react-router-dom'
import Index from '@renderer/pages/index'
import ShotScreen from '@renderer/pages/shotScreen'
import ViewShotScreen from '@renderer/pages/viewShotScreen'
import SelectVideoSource from '@renderer/pages/selectVideoSource'
import ViewRecordingVideo from '@renderer/pages/viewRecordingVideo'
import SettingPage from '@renderer/pages/settingPage'
import SoundRecording from '@renderer/pages/soundRecordingPage'
import SerachFilePage from '@renderer/pages/serachFilePage'
import { Context } from './index'
const App: FC = () => {
  const [states, setStates] = useState({
    windowScreenSource: undefined // 窗口截图源
  })
  return (
    <div className="app">
      <Context.Provider value={{ states, setStates }}>
        <HashRouter>
          <Routes>
            <Route path="/home" element={<Index />}>
              首页
            </Route>
            <Route path="/shotScreen" element={<ShotScreen />}>
              shotScreen
            </Route>
            <Route path="/viewShotScreen" element={<ViewShotScreen />}>
              viewShotScreen
            </Route>
            <Route path="/selectVideoSource" element={<SelectVideoSource />}>
              SelectVideoSource
            </Route>
            <Route path="/viewRecordingVideo" element={<ViewRecordingVideo />}>
              viewRecordingVideo
            </Route>
            <Route path="/settingPage" element={<SettingPage />}>
              settingPage
            </Route>
            <Route path="/soundRecording" element={<SoundRecording />}>
              SoundRecording
            </Route>
            <Route path="/serachFilePage" element={<SerachFilePage />}>
              SerachFilePage
            </Route>
            {/* 添加重定向 */}
            <Route path="/" element={<Navigate to="/home" replace />} />
          </Routes>
        </HashRouter>
      </Context.Provider>
    </div>
  )
}

export default App
